﻿using DayuCode.Designer.Entity;
using DayuCode.Designer.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DayuCode.Designer.Service
{
    public class FuncHandler
    {
        private static string getBaseUrl(string methodName)
        {
            return AppInstance.ApiServer + "api/base/dayucode_funcHandler/" + methodName;
        }

		public static Func getFunc(long id)
		{
			Func obj = QHttpClient.Post<Func>(getBaseUrl("getFunc"), new { id = id });
			return obj;
		}

		public static Func saveFunc(Func item)
		{
			Func obj = QHttpClient.Post<Func>(getBaseUrl("saveFunc"), new { item = item});
			return obj;
		}

		public static void deleteFunc(long id)
		{
			QHttpClient.Execute(getBaseUrl("deleteFunc"), new { id = id });
		}

		public static IList<Func> getAllFuncs(long projectId)
		{
			IList<Func> obj = QHttpClient.Post<List<Func>>(getBaseUrl("getAllFuncs"), new { projectId = projectId });
			return obj;
		}

		public static IList<Func> getChildFuncs(long projectId, long pId)
		{
			IList<Func> obj = QHttpClient.Post<List<Func>>(getBaseUrl("getChildFuncs"), new { projectId = projectId, pId = pId });
			return obj;
		}

		public static FuncVO getFuncVO(long id, long projectId)
		{
			FuncVO obj = QHttpClient.Post<FuncVO>(getBaseUrl("getFuncVO"), new { id = id, projectId = projectId });
			return obj;
		}



	}
}
